//
//  UITableView+Extension.swift
//  todaySwift
//
//  Created by ChokWah on 2018/3/13.
//  Copyright © 2018年 ChokWah. All rights reserved.
//

import Foundation
import UIKit

extension UITableView {
    func cwc_registerCell<T: UITableViewCell>(cell: T.Type) where T: RegisterCellOrNib {
        if let nib = T.nib {
            register(nib, forCellReuseIdentifier: T.identifier)
        }else {
            register(cell, forCellReuseIdentifier: T.identifier)
        }
    }
    
    func cwc_dequeueReusableCell<T: UITableViewCell>(indexPath: IndexPath)  -> T where T : RegisterCellOrNib {
        return dequeueReusableCell(withIdentifier: T.identifier, for: indexPath) as! T
    }
}
